<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>noerror-example</title>
</head>
<body>
<h1>报错页面<h1>
 <script>
    function report(paramObj, level) {
        var reportUrl = "/report";
        let paramArray = [], paramString = '';
        for(let key in paramObj){
            paramArray.push(key + '=' + encodeURIComponent(paramObj[key]));
        }

        reportUrl += (reportUrl.indexOf('?') > -1 ? '&' : '?') + paramArray.join('&');
        
        new Image().src = reportUrl;
    }

    window.onerror = function (msg, url, row, col, error) {
        console.log('onerror 错误信息 ↙');
        console.log(msg)
        if (error) {
            console.error(error.stack || msg);
        }
        var reportMsg = {
            msg: msg,
            url: url,
            row: row,
            col: col,
        }; // 错误信息
        console.log(reportMsg)
        report(reportMsg); // 将消息上报到错误收集平台
    };
    </script>
    <!-- <script src="http://127.0.0.1:8077/main.js"></script> -->
    <script src="./main.min.js" crossorigin></script>
</body>
</html>